package io.github.cocoa.module.socket.mq.consumer.sample;

import io.github.cocoa.module.socket.mq.message.sample.SampleInfoOneMessage;
import io.github.cocoa.module.socket.mq.message.sample.SampleInfoTwoMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 针对 {@link SampleInfoOneMessage} 的消费者
 * 针对 {@link SampleInfoTwoMessage} 的消费者
 * <p>
 * 多个方法版本
 *
 * @author James
 */
@Component
@Slf4j
public class SampleInfoMultipleConsumer {

    @EventListener
    @Async // Spring Event 默认在 Producer 发送的线程，通过 @Async 实现异步
    public void oneMethod(SampleInfoOneMessage message) {
        log.info("[oneMethod][消息内容({})]", message);
    }

    @EventListener
    @Async // Spring Event 默认在 Producer 发送的线程，通过 @Async 实现异步
    public void twoMethod(SampleInfoTwoMessage message) {
        log.info("[twoMethod][消息内容({})]", message);
    }

}
